Unpack xen_features into an array of u8 'booleans'
authorIan.Campbell@xensource.com <Ian.Campbell@xensource.com>
Wed, 1 Feb 2006 20:11:18 +0000 (20:11 +0000)
committerIan.Campbell@xensource.com <Ian.Campbell@xensource.com>
Wed, 1 Feb 2006 20:11:18 +0000 (20:11 +0000)
This allows us to avoid including bitops.h all over the tree as well
as avoiding any potential endianness issues in the future.

Use __read_mostly on the xen_features array now that the tree is based
on a version of Linux which supports it.

Also export xen_features for use in modules.

Signed-off-by: Ian Campbell <Ian.Campbell@XenSource.com>
linux-2.6-xen-sparse/drivers/xen/core/features.c
linux-2.6-xen-sparse/include/xen/features.h

index 82cd9d66a59de9e0c0173a972c7dcde37b3e4e6b..4f21d2cbdd50723545dd81134f030137542bda47 100644 (file)
@@ -7,22 +7,23 @@
  */
 #include <linux/types.h>
 #include <linux/cache.h>
+#include <linux/module.h>
 #include <asm/hypervisor.h>
 #include <xen/features.h>
 
-/* When we rebase to a more recent Linux we can use __read_mostly here. */
-unsigned long xen_features[XENFEAT_NR_SUBMAPS] __cacheline_aligned;
+u8 xen_features[XENFEAT_NR_SUBMAPS * 32] __read_mostly;
+EXPORT_SYMBOL(xen_features);
 
 void setup_xen_features(void)
 {
-       uint32_t *flags = (uint32_t *)&xen_features[0];
        xen_feature_info_t fi;
-       int i;
+       int i, j;
 
        for (i=0; i<XENFEAT_NR_SUBMAPS; i++) {
                fi.submap_idx = i;
                if (HYPERVISOR_xen_version(XENVER_get_features, &fi) < 0)
                        break;
-               flags[i] = fi.submap;
+               for (j=0; j<32; j++)
+                       xen_features[i*32+j] = !!(fi.submap & 1<<j);
        }
 }
index 3c62c6a46d8fcf94e7212a9a02e849348766bbe3..fd47bef25a734ba1fecf63525127d42edcc7efe9 100644 (file)
@@ -13,8 +13,8 @@
 
 extern void setup_xen_features(void);
 
-extern unsigned long xen_features[XENFEAT_NR_SUBMAPS];
+extern u8 xen_features[XENFEAT_NR_SUBMAPS * 32];
 
-#define xen_feature(flag)      (test_bit(flag, xen_features))
+#define xen_feature(flag)      (xen_features[flag])
 
 #endif /* __ASM_XEN_FEATURES_H__ */